package com.shtel.paas.monitorcenter.monitoring.alarm.management.warn.operate.service.impl;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.shtel.paas.monitorcenter.monitoring.alarm.management.warn.operate.mapper.AlarmRuleMapper;
import com.shtel.paas.monitorcenter.monitoring.alarm.management.warn.operate.mapper.HostMapper;
import com.shtel.paas.monitorcenter.monitoring.alarm.management.warn.operate.service.WarmOperateService;
import com.shtel.paas.monitorcenter.util.commed.Cmd;
import com.shtel.paas.monitorcenter.util.commed.Command;
import com.shtel.paas.monitorcenter.util.commed.CommandGaugeExports;

@Service
public class WarmOperateServiceImpl implements WarmOperateService {

	@Autowired
	private AlarmRuleMapper alarmRuleMapper;
	
	@Autowired
	private HostMapper hostInfoMapper;
	
	@Override
	public String getWarmDetial(String hostIp, String kpiName) {
		
		String cmd = alarmRuleMapper.queryDetialsCmd(kpiName);
		String result = "";
//		HostInfo hostInfo = hostInfoMapper.quertHostInfo(hostIp);
		
		if(null==cmd || "".equals(cmd)) {
			return result;
		}
		
		
		List<Cmd> list = new ArrayList<Cmd>();
		Cmd p2 = new Cmd(hostIp,cmd);
		list.add(p2);
		CommandGaugeExports p = new CommandGaugeExports();
		List<Command> command = p.getCommand(list);
		for(Command c : command) {
			result = result + c.getCommand();
			System.out.println(c.getCommand());
		}
		
		return result;
	}
	
}
